import http from '@/utils/http'

const BASE_URL = '/task/userDuty'

export interface UserDutyResp {
  taskId: string
  userId: string
  createUserString: string
  updateUserString: string
}
export interface UserDutyDetailResp {
  taskId: string
  userId: string
  createUserString: string
  updateUserString: string
}
export interface UserDutyQuery {
  taskId: string
  userId: string
  sort: Array<string>
}
export interface UserDutyPageQuery extends UserDutyQuery, PageQuery {}

/** @desc 查询测试任务用户关系列表 */
export function listUserDuty(query: UserDutyPageQuery) {
  return http.get<PageRes<UserDutyResp[]>>(`${BASE_URL}`, query)
}

/** @desc 查询测试任务用户关系详情 */
export function getUserDuty(id: string) {
  return http.get<UserDutyDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增测试任务用户关系 */
export function addUserDuty(data: any) {
  return http.post(`${BASE_URL}`, data)
}

/** @desc 修改测试任务用户关系 */
export function updateUserDuty(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除测试任务用户关系 */
export function deleteUserDuty(id: string) {
  return http.del(`${BASE_URL}/${id}`)
}

/** @desc 导出测试任务用户关系 */
export function exportUserDuty(query: UserDutyQuery) {
  return http.download<any>(`${BASE_URL}/export`, query)
}
